package cn.itsource.controller.app;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;

import cn.itsource.pojo.ro.AppLoginRo;
import cn.itsource.result.JSONResult;
import cn.itsource.service.ILoginService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Tag(name = "App登录表",description = "App登录表")
@RestController
@RequestMapping("/app/login")
public class AppLoginController {
    @Autowired
    private ILoginService loginService;
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    @Operation( summary= "Login",description = "登录接口")
    @Parameter(name = "login",description = "登录对象",required = true)
    @PostMapping
    @SaIgnore
    public JSONResult appLogin(@RequestBody @Valid AppLoginRo login){
       /* redisTemplate.opsForValue().set("test","测试");*/
        return loginService.appLogin(login);
    }

    @Operation( summary= "pictureOnload",description = "登录接口")
    @Parameter(name = "pictureOnload",description = "登录对象",required = true)
    @PostMapping("/pictureOnload")
    @SaIgnore
    public JSONResult pictureOnload(@RequestBody @Valid String path){
        return loginService.pictureOnload(path);
    }

}
